$:.unshift(File.expand_path(File.dirname(__FILE__)+"/../lib"))
$:.unshift(File.expand_path(File.dirname(__FILE__)+"/../ext"))

require "test/unit"
begin
    require 'statsample'
    HAS_SS=true
rescue
    HAS_SS=false
end

if(HAS_GSL.nil?)
begin
    require 'rbgsl'
    HAS_GSL=true
rescue
    HAS_GSL=false
end
end

require "alglib"
require 'matrix'
class TestAlglib < Test::Unit::TestCase
  def test_logit
        a=[1,2,3,4,5,6,7,8,9,10]
        b=[0,0,1,0,0,0,1,1,1,1]
        matrix=Matrix.columns([a,b])
        lr=Alglib::Logit.build_from_matrix(matrix)
  end
  def atest_logit_1
      ds=Statsample::CSV.read(File.dirname(__FILE__)+"/sample_logit.csv")
      ds['female'].recode! {|c|
          c=='female' ? 1: 0
      }
      constant=[1]*(ds.cases)
      matrix=Matrix.columns([ds['female'].data,ds['hon'].data])
      lr=Alglib::Logit.build_from_matrix(matrix)
      lr.unpack
      matrix=Matrix.columns([ds['math'].data, ds['female'].data,ds['read'].data, ds['hon'].data])
      lr=Alglib::Logit.build_from_matrix(matrix)

  end
end
